package net.jiupinshi.common;

import net.jiupinshi.enums.CommonEnum.ResultStatusEnum;

import java.io.Serializable;

/**
 * @Despription: 统一返回对象
 * @Author: penghui.guo
 * @Date: 2018/10/5 11:31
 */
public class Result<T> implements Serializable{

    private static final long serialVersionUID = 3038487681872306049L;

    private String msg = ResultStatusEnum.FAIL.desc;

    private T data;

    /**
     * 1 成功 0 失败 999 重新登录
     */
    private int code = ResultStatusEnum.FAIL.code;

    public Result(){

    }

    public Result(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

    public void setSuccess(){
        this.code = ResultStatusEnum.SUCCESS.code;
        this.msg = ResultStatusEnum.SUCCESS.desc;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
